<?php

namespace app\api\model\foods;

use app\api\model\Models;
use think\model\concern\SoftDelete;
use app\api\traits\model\foods\FoodCategory as FoodCategoryTraits;

class FoodCategory extends Models
{
    use SoftDelete,FoodCategoryTraits;

    /**
     * 定义软删除标记字段
     * @var string
     */
    protected $deleteTime = 'delete_at';

    /*
     * 定义全局的查询范围
     * @var array
     */
    protected $globalScope = ['status'];

    /**
     * 只查可用状态的
     * @param \think\db\Query $query
     * @return void
     */
    public function scopeStatus( \think\db\Query $query )
    {
        $query->where('status', 0);
    }

}
